import { post ,get,postFormData} from '@/request/http'
import { toString } from '@/utils/utils'
import store from '@/store'

//客户管理查询
export  const getAuditUserToList=({cltCliName,PageIndexs,PageSizes})=>{
  return   post('/FTKJWLHYPT/base/getAuditUserToList',{

    Data: {
      Parameters: {
        FTKJWLHYPT: {cltCliName   //客户企业名称
        }
      },
      Orderbys: {},
      PageIndex: {
        FTKJWLHYPT: PageIndexs
      },
      PageSize: {
        FTKJWLHYPT: PageSizes
      }
    }
  }
  )
}

//添加客户
export const addTmClientDetail=({cltName,cltAgmclt,cltVlflag,
  cltCode,
  cltEgsname,
  cltContact,
  cltCtctel,
  cltAccount,
  cltAddress,
  cltCliCode,
  cltCliAddress,
  cltCliLegalname,
  cltTypes,
  cltShtname,
  cltPorts,
  cltRegistorno,
  cltCliLegalid,
  cltRemark,})=>{
  return post('/FTKJWLHYPT/base/addTmClientDetail',{
    Data: {
      Parameters: {
        FTKJWLHYPT: {cltName,fctFltId:'-1',cltAgmclt,cltVlflag,
          cltCode,
          cltEgsname,
          cltContact,
          cltCtctel,
          cltAccount,
          cltAddress,
          cltCliCode,
          cltCliAddress,
          cltCliLegalname,
          cltTypes,
          cltShtname,
          cltPorts,
          cltRegistorno,
          cltCliLegalid,
          cltRemark,
          cltLstupduser:'eeee',
          cltInsertuser:'ttttt'
        }
      }
    }
  })
}

//删除客户
export const deleteTmClientDetail=(cltId)=>{
  return post('/FTKJWLHYPT/base/deleteTmClientDetail',{
    Data: {
      Parameters: {
        FTKJWLHYPT: {cltId:cltId.toString()
        }
      }
    }
  })
}

//编辑客户
export const editTmClientDetail=({cltName,cltAgmclt,cltVlflag,cltId,
  cltCode,
  cltEgsname,
  cltContact,
  cltCtctel,
  cltAccount,
  cltAddress,
  cltCliCode,
  cltCliAddress,
  cltCliLegalname,
  cltTypes,
  cltShtname,
  cltPorts,
  cltRegistorno,
  cltCliLegalid,
  cltRemark,})=>{
  return post('/FTKJWLHYPT/base/editTmClientDetail',{
    Data: {
      Parameters: {
        FTKJWLHYPT: {cltName,fctFltId:'-1',cltAgmclt,cltVlflag,cltId, //客户id
          cltCode,
          cltEgsname,
          cltContact,
          cltCtctel,
          cltAccount,
          cltAddress,
          cltCliCode,
          cltCliAddress,
          cltCliLegalname,
          cltTypes,
          cltShtname,
          cltPorts,
          cltRegistorno,
          cltCliLegalid,
          cltRemark,
        }
      }
    }
  })
}

//港口下拉框查询
export const getPortsInfo=()=>{
  return get('/FTKJWLHYPT/base/getPortsInfo')
}

//图片上传
export const addImg=(file,name)=>{
  let formData = new FormData()
  formData.append('fileField', file)
  formData.append('name', name)
  return postFormData ('/FTKJWLHYPT/base/addImg',formData)
}

//图片查看
export const showImg=(nowPath)=>{
  return post('/FTKJWLHYPT/base/showImg',{nowPath})
}
